package generic;

import generic.activemq.ActiveMqPublisher;
import generic.activemq.ActiveMqRedundantPublisher;
import generic.hornetq.HornetQPublisher;
import generic.rabbitmq.RabbitMqPublisher;
import generic.spread.SpreadPublisher;

public class PublisherMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Publisher publisher = null;

		String system = args[0];

		if (system.equalsIgnoreCase("ActiveMQ")) {
			// ActiveMQ
			String url = args[1];
			publisher = new ActiveMqPublisher(url);
		} else if (system.equalsIgnoreCase("ActiveMQRedundant")) {
			// ActiveMQRedundant
			String url1 = args[1];
			String url2 = args[2];
			publisher = new ActiveMqRedundantPublisher(url1, url2);
		} else if (system.equalsIgnoreCase("RabbitMQ")) {
			// RabbitMQ
			publisher = new RabbitMqPublisher();
		} else if (system.equalsIgnoreCase("HornetQ")) {
			// HornetQ
			String url = args[1];
			int port = Integer.parseInt(args[2]);
			publisher = new HornetQPublisher(url, port);
		} else if (system.equalsIgnoreCase("Spread")) {
			// Spread
			publisher = new SpreadPublisher();
		}
		
		PublisherClient client = new PublisherClient(publisher);
		client.send();
	}
}
